﻿using common;
using System;
using System.Diagnostics;
using System.IO;

public class RunFile
{
    public static void run(string filename)
    {
        string kuozhanming = Path.GetExtension(filename);
        if (kuozhanming.ToLower() == ".py")
        {
            Process.Start(filename);
        }
        else if (kuozhanming.ToLower() == ".htm")
        {
            com.openFile("iexplore.exe", filename);
            //Process.Start(filename);
        }
        else if (kuozhanming.ToLower() == ".sql")
        {
            //Form_sql fs = Form_sql.get_instance();
            //fs.sql = File.ReadAllText(filename);
            //fs.Show();
        }
        else if (kuozhanming.ToLower() == ".cs")
        {
            bianyi b = bianyi_factory.get_bianyi(kuozhanming);
            b.work(filename);
        }
        else
        {
            Process.Start(filename);
        }
    }

    public static void open_system(string filename)
    {
        try
        {
            Process.Start(filename);
        }
        catch (Exception ex) { }
    }
}